package com.tiankong.product.feign;

import com.tiankong.product.feign.model.SpuCouponInfo;
import feign.hystrix.FallbackFactory;
import net.youdi.common.model.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author: scl
 * @date: 2021-07-20 15:54
 * @description 优惠券服务
 */
@FeignClient(value = "coupon",fallbackFactory = CouponFeignClient.CouponFeignFallBack.class)
public interface CouponFeignClient {

    @PostMapping("spu/coupon/info/save")
    Result saveCoupon(@RequestBody SpuCouponInfo spuCouponInfo);

    @Component
    class CouponFeignFallBack implements FallbackFactory<CouponFeignClient>{

        @Override
        public CouponFeignClient create(Throwable cause) {
            return null;
        }
    }
}
